package web

import (
	"net/http"
	"time"
)

//
// 控制视图
//
type OperateController struct {}

//
// 操作视图
//
func (operate * OperateController)  Handler(response http.ResponseWriter, request *http.Request)   {

	// 7天有效
	expiration := time.Now()
	expiration = expiration.AddDate(0,0,7);

	// 设置Cookie
	member_id := http.Cookie{
		Name:"member_id",
		Value: "18565381403",
		Expires: expiration,
	}

	// 设置Cookie
	ws_addr := http.Cookie{
		Name:"ws_addr",
		Value: webSocketAddr,
		Expires: expiration,
	}

	http.SetCookie(response, &member_id)
	http.SetCookie(response, &ws_addr)

	template := staticFilePath + "operate.html"
	http.ServeFile(response, request, template)
}

